import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'layout',
    component: () => import(/* webpackChunkName: "layout" */ '@/views/layout/index.vue'),
    children: [{
      path: '/home',
      name: 'home',
      component: () => import(/* webpackChunkName: "home" */ '@/views/home/index.vue'),

    }, {
      path: '/classify',
      name: 'classify',
      component: () => import(/* webpackChunkName: "classify" */ '@/views/classify/index.vue'),

    }, {
      path: '/car',
      name: 'car',
      component: () => import(/* webpackChunkName: "car" */ '@/views/car/index.vue'),

    }, {
      path: '/my',
      name: 'my',
      component: () => import(/* webpackChunkName: "my" */ '@/views/my/index.vue'),
    }, {
      path: '/',
      redirect: '/home'
    }]
  },
  {
    path: '/posts/:id',
    name: 'detail',
    component: () => import(/* webpackChunkName: "detail" */ '@/views/detail/index.vue')
  },

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
